A mobile device often has a processing system with a trusted platform which uses protected software and protected hardware to help guarantee the confidentiality and integrity of stored data. Today there are several different techniques which can be used to confidentiality and integrity protect data in a processor system. Some of these existing techniques are as follows:                Tamper-proof memory and processing. Such memory may be an integral part of a processor chip and the read write operations to the memory are limited in such a way that they can only be performed via the processor system. The memory could also be an external memory which is protected from physical access by some tamper resistance technique.        One-time write-only memory. Such memory is usually used to store data which does not need to be secret but which should be impossible to change.        Processing systems in which a secret key is stored in integrity and confidentiality protected memory. This secret key is then used to encrypt and integrity protect data which is stored in rewritable openly accessible memory.        
The problem with techniques along the ideas in the third bullet above is that it may be possible for an attacker to replace current memory data with data that was recorded at an earlier time. This type of attack is well known from the early times of telephone cards and has been seen more recently with Subscriber Identity Module (SIM) cards which store the user's current amount in their prepaid account. Basically, the attacker records the memory data just when a SIM card has been loaded with a new value denoting a given amount of pre-paid service. Then, after the SIM card has been used an attacker would rewrite the current recorded memory data to be the earlier recorded memory data such that the SIM card now appears to have an unused value.
Another example is digital right management (DRM) protected data which often has limitations on the number of times it is allowed to be viewed/played by a user. In this case, a DRM counter must be stored and integrity protected. Similar to the SIM card case, the DRM counter is sensitive to replay attacks in which an attacker replaces a smaller current DRM counter value with a larger DRM counter value that was recorded at an earlier time. Accordingly, there is a need to prevent a replay attack by a person who would like to change information by replacing current memory data with previously recorded valid memory data. This problem and other problems are solved by the present invention.